import java.util.HashMap;
import java.util.Map;

public class StudentTest {
    public static void main(String[] args) {
         Student stu1=new Student(1,"张三",18);
         Student stu2=new Student(2,"李四",21);
         Student stu3=new Student();
         stu3.setStuid(3);
         stu3.setName("王事四");
         stu3.setAge(20);
        Map<Integer,Student> studentMap=new HashMap<>();
        studentMap.put(stu1.getStuid(),stu1);
        studentMap.put(stu2.getStuid(),stu2);
        studentMap.put(stu3.getStuid(),stu3);

        //循环取出学生姓名中包含 “四” 的学生信息
        studentMap.forEach((Integer stuid,Student student)->{
            String name = student.getName();
            if (name.contains("四")){
                System.out.println(student);
            }

        });


    }
}
